<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" import="java.util.List,com.wit.po.Clientlevel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户联系人</title>
<link href="../style/main.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="../style/style.css" />

<script>

 	function changeV(objID)
	{
		if(document.getElementById("tbody_"+objID).style.display == "block")
		{
			
			document.getElementById("img_"+objID).src = "../images/ico_have2.gif";
			document.getElementById("tbody_"+objID).style.display = "none"
		}
		else
		{
			document.getElementById("img_"+objID).src = "../images/ico_nohave2.gif";
			document.getElementById("tbody_"+objID).style.display = "block"
		}
	}
	function startEdit()
	{
		var obj;
		var i = 0;
		while((obj = document.getElementById("chk"+i)) != null)
		{
			if(obj.checked)
			{
				document.location="level!startEdit?levelId="+obj.value;
				return;
			}
			i++;
		}
		alert("必须选择一个客户级别");
	}
	function removeLevel()
	{
		var obj;
		var i = 0,counter = 0,id;
		while((obj = document.getElementById("chk"+i)) != null)
		{
			if(obj.checked)
			{
				id = obj.value;
				counter ++;
			}
			i++;
		}
		if(counter > 1)
			alert("只能删除一个客户级别信息");
		else if(counter == 1)
			document.location = "level!removeClientlevel?levelId="+id;
		else
			alert("必须选择一个客户级别");
	}
</script>
    
<%@ taglib prefix="s" uri="/struts-tags" %>

</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0" class="table">
  <tr>
    <td>
      <table width="100%"  cellpadding="0" cellspacing="0" class="table2">
        <tr>
          <td valign="top">
            <table width="100%" class="top" cellpadding="0" cellspacing="0">
              <tr>
                <td>当前位置:&nbsp;<a href="#">客户管理</a>&nbsp;>>&nbsp;<a href="#">客户级别</a></td>
              </tr>
            </table>
			<div id="mainareacontent">
        <div class="mainarea">

                    <table width="100%" cellpadding="0" cellspacing="0"class="table3">
                        <tr>
                            <td width="6%" class="title">&nbsp;</td>
                            <td width="5%"><span class="clientinfo_but" ><a href="clientlevel_new.jsp">新&nbsp;增</a></span></td>
                            <td width="5%"><span class="clientinfo_but"><a onclick="javascript:startEdit();" href="javascript:void(0);">修&nbsp;改</a></span></td>
                            <td width="5%"><a onclick="javascript:removeLevel();" href="javascript:void(0);"><img src="../images/btn_del.gif" alt="3" width="50" height="20" /></a></td>
                            <td width="18%">&nbsp;</td>
                            <td width="5%"><span class="clientinfo_but">导&nbsp;入</span></td>
                            <td width="5%"><span class="clientinfo_but">导&nbsp;出</span></td>
                          
                            <td width="5%"><span class="clientinfo_but">打&nbsp;印</span></td>  
                            <td width="14%">&nbsp;</td>
                        </tr>
                    </table>

            <table cellpadding="0" cellspacing="0" width="100%" class="table5">
              <tr>
                <th height="29" bgcolor="#BBD2F7" class="title">客户级别列表</th>
              </tr>
              
            </table>
            <table width="100%" cellpadding="0" cellspacing="1" class="dg_borderstyle">
            <THEAD>  <tr>
                <th width="30"> <input type="checkbox" onclick="docheck()" id="chk_all" /></th>
                <th width="150">客户级别</th>
                <th>描述</th>
                </tr>
            </THEAD>
            <tbody id="offTblBdy">
				<%
					List<Clientlevel> levelList = (List<Clientlevel>)request.getAttribute("levelList");
					if(levelList == null)
					{
						out.println("<p>获取客户级别列表失败</p>");
					}
					else
					{
						int size = levelList.size();
						Clientlevel level;
						for(int i=0;i<size;i++)
						{
							level = levelList.get(i);
				%>
						<tr>
							<td>
								<input type="checkbox" id=<%="chk"+i %> value="<%=level.getClientlevelId() %>" />
							</td>
							<td>
								<%=level.getClientlevelId() %>
							</td>
							<td>
								<%=level.getClmemo() %>
							</td>
						</tr>
				<%
						}
					}
				 %>
			</tbody>
            </table>

            <table width="100%" cellpadding="0" cellspacing="0" class="dg_pagestyle">
                <tr>
                    <td class="pageinfo">&nbsp;</td>
                    <td class="pagebutton">&nbsp;</td>
                </tr>
            </table>
        </div>
      </div>          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
